/**
 * 
 */
package com.shine.icis.hbean;

import java.text.DecimalFormat;

import com.shine.icis.config.SysCodeDictLoader;

/**
 * 对应部分A13应收应付信息
 * @author zsy
 *
 */
public class AccrualInfo {
	private DecimalFormat doubleFormat = new DecimalFormat("0.00");
	
	private Long id;
	private int tradeDate;//交易日期
	private String arapType;//应收应付类型
	private String oppPar;//对方机构
	private String mktCodeSipf;//市场代码
	private String arapBusiType;//业务类型
	private String curTypeSipf;//币种类别
	private int harapDate;//已收付日期
	private int busiDate;//业务日期
	private String arapReason;//应收付原因
	private double arapAmt;//应收应付金额
	private Integer arapDate;//应收付日期
	private String summary;//摘要信息
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public int getTradeDate() {
		return tradeDate;
	}
	public void setTradeDate(int tradeDate) {
		this.tradeDate = tradeDate;
	}
	public String getArapType() {
		return arapType;
	}
	public void setArapType(String arapType) {
		this.arapType = arapType;
	}
	public String getOppPar() {
		return oppPar;
	}
	public void setOppPar(String oppPar) {
		this.oppPar = oppPar;
	}
	public String getMktCodeSipf() {
		return mktCodeSipf;
	}
	public void setMktCodeSipf(String mktCodeSipf) {
		this.mktCodeSipf = mktCodeSipf;
	}
	public String getArapBusiType() {
		return arapBusiType;
	}
	public void setArapBusiType(String arapBusiType) {
		this.arapBusiType = arapBusiType;
	}
	public String getCurTypeSipf() {
		return curTypeSipf;
	}
	public void setCurTypeSipf(String curTypeSipf) {
		this.curTypeSipf = curTypeSipf;
	}
	public int getHarapDate() {
		return harapDate;
	}
	public void setHarapDate(int harapDate) {
		this.harapDate = harapDate;
	}
	public int getBusiDate() {
		return busiDate;
	}
	public void setBusiDate(int busiDate) {
		this.busiDate = busiDate;
	}
	public String getFormatBusiDate() {
		StringBuffer date = new StringBuffer(Integer.toString(busiDate));
		date.insert(6, "-").insert(4, "-");
		return date.toString();
	}
	public String getArapReason() {
		return arapReason;
	}
	public void setArapReason(String arapReason) {
		this.arapReason = arapReason;
	}
	public double getArapAmt() {
		return arapAmt;
	}
	public String getArapAmtText() {
		return doubleFormat.format(arapAmt);
	}
	public void setArapAmt(double arapAmt) {
		this.arapAmt = arapAmt;
	}
	public Integer getArapDate() {
		return arapDate;
	}
	public void setArapDate(Integer arapDate) {
		this.arapDate = arapDate;
	}
	public String getSummary() {
		return summary;
	}
	public void setSummary(String summary) {
		this.summary = summary;
	}
	
	public String getFormatTradeDate() {
		StringBuffer date = new StringBuffer(Integer.toString(tradeDate));
		date.insert(6, "-").insert(4, "-");
		return date.toString();
	}
	public String getFormatHarapDate() {
		StringBuffer date = new StringBuffer(Integer.toString(harapDate));
		date.insert(6, "-").insert(4, "-");
		return date.toString();
	}
	public String getFormatArapDate() {
		if (arapDate == null) {
			return "";
		}
		StringBuffer date = new StringBuffer(Integer.toString(arapDate));
		date.insert(6, "-").insert(4, "-");
		return date.toString();
	}
	
	public String getArapTypeText() {
		return arapType + ":" + SysCodeDictLoader.getInstance().getArapTypeConfText(arapType);
	}
	public String getArapReasonText() {
		return arapReason + ":" + SysCodeDictLoader.getInstance().getArapReasonConfText(arapReason);
	}
	public String getOppParText() {
		String tem = SysCodeDictLoader.getInstance().getOppParConfText(oppPar);
		return tem != null ? (oppPar + ":" + tem) : ("TA代码:" + oppPar);
	}
	public String getMktCodeSipfText() {
		return mktCodeSipf + ":" + SysCodeDictLoader.getInstance().getMktCodeSipfConfText(mktCodeSipf);
	}
	public String getArapBusiTypeText() {
		return arapBusiType + ":" + SysCodeDictLoader.getInstance().getArapBusiTypeConfText(arapBusiType);
	}
	public String getCurTypeSipfText() {
		return curTypeSipf + ":" + SysCodeDictLoader.getInstance().getCurTypeSipfConfText(curTypeSipf);
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final AccrualInfo other = (AccrualInfo) obj;
		if (id == null) {
//			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	
	
	
}
